<template>
  <div id="form">
    <el-row>
      <el-button type="primary" icon="el-icon-loading" @click="handleClick">查看Region</el-button>
      <el-button icon="el-icon-search" @click="handleClick">Default</el-button>
      <el-button round type="success" icon="el-icon-setting" @click="handleMessageClick">Default</el-button>
      <el-button type="info" icon="el-icon-share"  loading>
        上传<i class="el-icon-upload el-icon--right"></i>
      </el-button>
      <el-button type="danger" icon="el-icon-edit" @click="open" circle></el-button>
    </el-row>

    <el-row :gutter="20">
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
    </el-row>

    <el-container style="width: 80%; margin: 20px auto; border: 1px solid #ccc">
      <el-header class="header">header</el-header>
      <el-aside width="200px" style="background-color:rgb(238, 241, 246)">aside</el-aside>
      <el-main>main</el-main>
      <el-footer>footer</el-footer>
    </el-container>

    <el-select v-model="form.region" placeholder="请选择活动区域">
      <el-option label="区域一" value="shanghai"></el-option>
      <el-option label="区域二" value="beijing"></el-option>
    </el-select>

    <el-button type="success" @click="openDelivery">打开Dialog</el-button>

    <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="活动名称" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="活动区域" :label-width="formLabelWidth">
          <el-select v-model="form.region" placeholder="请选择活动区域">
            <el-option label="区域一" value="shanghai"></el-option>
            <el-option label="区域二" value="beijing"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'Pr',
  data () {
    return {
      form: {
        region: ''
      },
      formLabelWidth: '120px',
      dialogFormVisible: false
    }
  },
  methods: {
    handleClick () {
      this.$message('region: ' + this.form.region)
    },
    openDelivery () {
      this.dialogFormVisible = true
      // this.$alert('open delivery')
    },
    handleMessageClick () {
      this.$message('handleMessageClick')
    },
    open () {
      this.$alert('这是一段内容', '标题名称', {
        confirmButtonText: '确定',
        callback: action => {
          this.$message({
            type: 'info',
            message: `action: ${action}`
          })
        }
      })
    }
  }
}
</script>

<style>
.header {
  background-color: #409eff;
}

.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>
